<template>
	<uni-popup class="uni-popup" ref="popupRef" background-color="#fff" type="bottom" :is-mask-click="true">
		<view class="popup-view">
			<uni-icons class="close-icon" type="closeempty" size="30" @click="close"></uni-icons>
			<view class="popup-content">
				<view class="content-top">
					<view class="top-item">
						金额: <text style="font-size: 25px;color:#108ee9;font-weight: 700;">3000</text>
					</view>
					<view class="top-item">
						描述: <text>充3000元送200元</text>
					</view>
					<view class="top-item">
						<view class="item-left">
							门店: <text>北京华贸店</text>
						</view>
						<uni-icons class="forward" type="forward"></uni-icons>
					</view>
				</view>
				<view class="content-agree">
					<radio value="r1" :checked="radied" color="#108ee9" style="margin-right: 5px" @click="radioChange"/>
					<text>我已阅读并同意《随心改充值协议》</text>
				</view>
				<view class="popup-btn">
					<button @click="recharge">确认充值</button>
				</view>
			</view>
		</view>
	</uni-popup>
</template>

<script setup lang="ts">
	import { ref } from "vue"
	/**
	 * useTo: 弹出框属性，开关，暴露
	 */
	let popupRef = ref()
	const open = () => {
		popupRef.value.open("bottom")
	}
	const close = () => {
		popupRef.value.close()
	}
	defineExpose({ open })
	
	/**
	 * useTo: 阅读规则部分 
	 */
	let radied = ref<boolean>(true)
	const radioChange = () => {
		radied.value = !radied.value
	}
	/**
	 * useTo: 充值按钮事件 
	 */
	const recharge = () => {
		
	}
	
</script>
<script lang="ts">
	export default {
		options: {
		  styleIsolation: 'shared', // 解除样式隔离
		}
	}
</script>
<style scoped lang="scss">
	:deep(.uni-popup) {
		view {
			border-top-left-radius: 15rpx!important;
			border-top-right-radius: 15rpx!important;
		}
	}
	.popup-view {
		position: relative;
		padding: 20rpx;
		height: 100%;
		.close-icon {
			position: absolute;
			top: 15rpx;
			right: 15rpx;
			color: $uni-base-color;
		}
		.popup-content {
			padding: 30rpx 0;
			padding-left: 20rpx;
			padding-bottom: 20rpx;
			height: 100%;
			max-height: 43vh;
			overflow-y: auto;
			overflow-x: hidden;
			.content-top {
				.top-item {
					margin-bottom: 20rpx;
					font-size: 20px;
					text {
						margin-left: 20rpx;
					}
					&:last-child {
						display: flex;
						justify-content: space-between;
						align-items: center;
						.item-left {
							margin-right: 10rpx;
						}
					}
				}
			}
			.content-agree {
				margin-top: 50px;
				text {
					vertical-align: middle;
				}
			}
		}
		.popup-btn {
			margin-top: 50rpx;
			button {
				border-radius: 50rpx;
				color: #fff;
				letter-spacing: 10px;
				background: $uni-primary
			}
		}
	}
	// 样式穿透
	:deep(.uni-forms-item) {
		margin-bottom: 0rpx;
	}
	:deep(.uni-forms-item__content) {
		display: flex;
		align-items: center;
		flex-wrap: wrap;
		.item {
			padding: 15rpx!important;
			border-radius: 15rpx;
			border: 1px solid #dadada;
			margin-right: 20rpx;
			margin-bottom: 20rpx;
			&:last-child {
				margin-right: 0;
			}
		}
	}
	.store-item__actived {
		border-color: $uni-primary!important;
		color: $uni-primary;
	}
</style>